package com.multipleThread.myRestaurant;

import lombok.Data;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * @author 罗俊华
 * @date 2021/4/29 - 2:01 下午
 */
@Data
public class Food {

    private static final List<String> MENUS = Arrays.asList("米线", "面条", "红烧鸡", "火锅", "面包", "油条", "鸡蛋饭");

    private final int foodId;

    private static final Random RANDOM = new Random();

    private String foodName;

    private Food(String foodName, int foodId) {
        this.foodName = foodName;
        this.foodId = foodId;
    }

    public static Food getFood() {
        int foodId = RANDOM.nextInt(MENUS.size());

        return new Food(MENUS.get(foodId), foodId);
    }

    public static Food getFoodByFoodId(int foodId) {

        return new Food(MENUS.get(foodId), foodId);
    }
}
